﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace ClientAppraise.Converters;

public class IntToBoolConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value == default)
        {
            return false;
        }

        if (!int.TryParse(value.ToString(), out var TypeValue))
        {
            return false;
        }

        return TypeValue > 0?"是":"否";
    }
    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();

        //if (value == default)
        //{
        //    return 0;
        //}

        //if (!bool.TryParse(value.ToString(), out var TypeValue))
        //{
        //    return 0;
        //}

        //return TypeValue ? 1 : 0;
    }
}
